const express = require("express");
const router = express.Router();
const db = require('../../db/index');

const svgCaptcha = require('svg-captcha');//验证码


router.get('/captcha', (req, res) => {
  const captcha = svgCaptcha.create();
  res.type('svg');
  req.session.captcha = captcha.text;
  req.session.captchaTime = Date.now(); // 记录当前时间戳
 
    res.send(captcha.data);
});

module.exports = router;